<?php
 
// No direct access
 
defined('_JEXEC') or die('Restricted access'); 

//add javascript
$js5 = JURI::base().'components/com_nv/assets/js/mootools.js';
$js6 = JURI::base().'components/com_nv/assets/js/moodalbox.js';


$document 	=& JFactory::getDocument();
$document->addScript('components/com_nv/assets/js/livevalidation.js');

//add css
$css1 = JURI::base().'components/com_nv/assets/css/moodalbox.css';
$css2 = JURI::base().'components/com_nv/assets/css/common.css';

?>


<script type="text/javascript" src="<?echo $js5 ?>"></script>
<script type="text/javascript" src="<?echo $js6 ?>"></script>

<link rel="stylesheet" href=<?echo $css1 ?> type="text/css" media="screen" />
<link rel="stylesheet" href=<?echo $css2 ?> type="text/css" media="screen" />

<form action="index.php?option=com_nv&view=hotel" method="post" name="adminForm" id="adminForm">
<fieldset class="adminform">
<legend>Cari Hotel</legend>
<table class="admintable">

<tr>
<td>
Masukkan Inputan* :
</td>
<td align="left" class="key">
<input name="field_cari" type="text" id="teksinput" class="input" id="field_cari" />
    <script type="text/javascript">
        var field_cari = new LiveValidation('field_cari');
        field_cari.add( Validate.Presence ,{ failureMessage: "Harus Diisi..!!" });
    </script>
</td>

<td>
<input name="cari" type="submit" value="cari" class="button" />
</td>
</tr>


</table>
<table>

    <tr>
    <td colspan="3">*Inputan Dapat Berupa Nama Objek Pariwisata maupun Nama Kota</td>
    </tr>

</table>

<?php
	if ($_POST[field_cari]&&$this->rss){

//	echo $this->out;

        $items = $this->rss->get_items();

			$jumlah_hotel = $this->rss->get_item_quantity();
            $out = "hasil pencarian hotel di <strong>$_POST[field_cari]</strong> : <br/><br/>";

            $i=1;
			foreach($items as $item)
			{
                if ($i<=5){
                    $out .= '<b><em>'.$item->get_title().'</em></b><br/>';
                    $out .= $item->get_description().'<br/><br/>';
                }
				$i++;

			}//end of foreach
?>
<div class="result">
<fieldset>
    <legend>Sumber : http://www.indonesia-tourism.com/</legend>
<?
     echo "<br />";
     echo $out;
     ?>
        <a href="index2.php?option=com_nv&view=allhotel&input=<?echo $_POST[field_cari]?>" rel="moodalbox 800 500" title="<?echo $_POST[field_cari]?>">selengkapnya</a>
     </fieldset>
     <?


	}// akhir dari if

 else if ($_POST[field_cari]&& empty($this->rss)){
        $out = "Hasil Pencarian Terhadap <strong>$_POST[field_cari]</strong> Tidak Menemukan Hasil";
        echo $out;
    }

    ?>
</fieldset>
</div>

</form>